"""Definition of the Guia content type
"""

from zope.interface import implements, directlyProvides

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

from newguegue.newmunicipios import newmunicipiosMessageFactory as _
from newguegue.newmunicipios.interfaces import IGuia
from newguegue.newmunicipios.config import PROJECTNAME

GuiaSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-
   atapi.StringField('title',
                searchable=1,
                isMetadata=0,
                accessor='Title',
                required=1,
                widget=atapi.StringWidget(label='Título',
                                      maxlength=150,
                                      size=30,
                                      label_msgid="label_entry_title",
                                      description_msgid="help_entry_title",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='Título')),
    atapi.StringField('description',
                searchable=1,
                isMetadata=0,
                required=1,
                accessor='Description',
                widget=atapi.TextAreaWidget(label='Breve descripción',
                                      label_msgid="label_entry_description",
                                      description_msgid="help_entry_description",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='Entre una breve descripción.')),
    atapi.StringField('direccion',
                searchable=1,
                isMetadata=0,
                required=1,
                widget=atapi.StringWidget(label='Dirección Física',
                                      maxlength=750,
                                      size=50,
                                      label_msgid="label_entry_direccion",
                                      description_msgid="help_entry_direccion",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='Dirección Física')),
    atapi.StringField('horario',
                searchable=1,
                required=0,
                widget=atapi.StringWidget(label='Horario de atención:',
                                      maxlength=750,
                                      size=50,
                                      label_msgid="label_entry_desde",
                                      description_msgid="help_entry_desde",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='')),
    atapi.StringField('telefono',
                searchable=0,
                isMetadata=0,
                required=1,
                widget=atapi.StringWidget(label='Teléfono',
                                      label_msgid="label_entry_telefono",
                                      description_msgid="help_entry_telefono",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='Teléfono')),
    atapi.StringField('fax',
                searchable=1,
                isMetadata=0,
                widget=atapi.StringWidget(label='Fax',
                                      label_msgid="label_entry_fax",
                                      description_msgid="help_entry_fax",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='')),
    atapi.TextField('body',
              searchable=1,
              primary=1,
              required=1,
              default_content_type='text/html',
              default_output_type='text/html',
              allowable_content_types=('text/plain','text/structured', 'text/html', 'text/restructured'),
              widget=atapi.RichWidget(label='Servicios',
                                label_msgid="label_entry_body",
                                description_msgid="help_entry_body",
                                i18n_domain="newguegue.newmunicipios",
                                description="Descripción completa")),

    atapi.StringField('email',
                searchable=1,
                isMetadata=0,
                widget=atapi.StringWidget(label='Email',
                                      label_msgid="label_entry_email",
                                      description_msgid="help_entry_email",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='')),
    atapi.StringField('web',
                searchable=1,
                isMetadata=0,
                widget=atapi.StringWidget(label='Sitio web',
                                      label_msgid="label_entry_web",
                                      description_msgid="help_entry_web",
                                      i18n_domain="newguegue.newmunicipios",
                                      description='')),


))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

#GuiaSchema['title'].storage = atapi.AnnotationStorage()
#GuiaSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(GuiaSchema, moveDiscussion=False)

class Guia(base.ATCTContent):
    """Guia turistica para los municipios"""
    implements(IGuia)

    portal_type = "Guia"
    schema = GuiaSchema

    #title = atapi.ATFieldProperty('title')
    #description = atapi.ATFieldProperty('description')

atapi.registerType(Guia, PROJECTNAME)
